﻿<sap:ActivityDesigner x:Class="TfsCloudDeploy.Workflow.Core.DeploymentService.Activities.Design.BindingScopeDesigner"    
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       
                      xmlns:s="clr-namespace:System;assembly=mscorlib"                       
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
                      xmlns:sxl="clr-namespace:System.Xml.Linq;assembly=System.Xml.Linq" 
                      xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"      
                      xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"       
                      xmlns:conv="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"        
                      mc:Ignorable="d"        
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    
                      xmlns:radc="clr-namespace:TfsCloudDeploy.Workflow.Core.Converters"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" IsHitTestVisible="True">
    <sap:ActivityDesigner.Resources>
        <conv:ArgumentToExpressionConverter x:Key="expressionConverter"/>
        <radc:XmlArgumentToExpressionConverter x:Key="XmlArgumentToExpressionConverter" x:Uid="_2"  />
        <DataTemplate x:Key="Collapsed">
            <StackPanel>
                <TextBlock>This is the collapsed view</TextBlock>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="Expanded">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Margin="2">Binding:</TextBlock>
                <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1" Name="stackPanel">
                    <sapv:ExpressionTextBox 
                            Expression="{Binding Path=ModelItem.Binding, Mode=TwoWay, Converter={StaticResource XmlArgumentToExpressionConverter}, ConverterParameter=In, UpdateSourceTrigger=PropertyChanged}"                                                              
                            ExpressionType="s:Object"
                            OwnerActivity="{Binding ModelItem}"
                            MinLines="2" MaxLines="15" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" FontSize="10" MaxWidth="300" />
                </StackPanel>
                <sap:WorkflowItemPresenter Item="{Binding ModelItem.Body}"
                               HintText="Drop Send Activity"
                               Margin="6"
                               Grid.Row="1"
                               Grid.Column="0"
                               Grid.ColumnSpan="2"/>
            </Grid>
        </DataTemplate>
        <Style x:Key="ExpandOrCollapsedStyle" TargetType="{x:Type ContentPresenter}">
            <Setter Property="ContentTemplate" Value="{DynamicResource Collapsed}"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=ShowExpanded}" Value="true">
                    <Setter Property="ContentTemplate" Value="{DynamicResource Expanded}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </sap:ActivityDesigner.Resources>
    <Grid>
        <ContentPresenter Style="{DynamicResource ExpandOrCollapsedStyle}" Content="{Binding}" />
    </Grid>
</sap:ActivityDesigner>
